package per.chenyl.framework.persistence.mapper;

import per.chenyl.framework.persistence.wrapper.Wrapper;

import java.util.List;

public interface BaseMapper<T> {
    /**
     * @param entity
     * @param schema 查询表对应shema，没有就省略
     * @return
     * @desc 插入
     * @method insert
     * @author YulinChen
     * @date 2020/4/23 17:09
     */
    boolean insert(T entity, String... schema);

    boolean batchInsert(List<T> entitys, String... schema);

    boolean update(T entity, Wrapper<T> wrapper, String... schema);

    boolean batchUpdate(List<T> entitys, Wrapper<T> wrapper, String... schema);

    /**
     * @param wrapper 条件构造器，查询所有直接给个新对象
     * @return
     * @desc 查询某条数据
     * @method selectOne
     * @author YulinChen
     * @date 2020/4/23 17:09
     */
    T selectOne(Wrapper<T> wrapper, String... schema);

    List<T> selectAll(Wrapper<T> wrapper, String... schema);

    void delete(Wrapper<T> wrapper, String... schema);

    void batchDelete(Wrapper<T> wrapper, String... schema);
}
